<layout name="inner"/>

<include file="Public:angular"/>
<script>
App.controller("trackcontroller",["$scope",function($scope){

$scope.upload=function(url){
//console.log($scope.track);
$.getJSON(url+"/dv_oid/"+$scope.track.dv_oid+"/dv_tk_id/"+$scope.track.dv_tk_id+"/dv_number/"+$scope.track.dv_number,function(data){
	   UIkit.modal.confirm(data.info, function(){
		location.reload();
		});
})

}
}])
</script>

<p>
<!-- Button trigger modal -->
<button type="button" class="uk-button uk-button-success" data-uk-modal="{target:'#myModal',center:true}">
{$Think.lang.add_delivery}
</button>
<button type="button" class="uk-button uk-button-success" data-uk-modal="{target:'#myModal1',center:true}">
{$Think.lang.bulk_add_delivery}
</button>

<button type="button" class="uk-button uk-button-primary" data-uk-modal="{target:'#myModal2',center:true}">
{$Think.lang.track_company}
</button>
</p>

<form class="uk-form"  action="__CONTROLLER__/index">
    <div class="uk-grid">
		<div class="uk-width-medium-1-4 uk-width-small-1-2">{$Think.lang.oid}:<input type="text" name="dv_oid" placeholder="" class="uk-width-1-1"></div>
		 <div class="uk-width-medium-1-4 uk-width-small-1-2">{$Think.lang.delivery_no}:<input type="text" name="dv_number" placeholder="" class="uk-width-1-1"></div>
				    
    </div>
	<p>
<button type="submit" class="uk-button uk-button-danger">{$Think.lang.search}</button>
</p>
</form>

          <div class="uk-overflow-container">
            <table class="uk-table uk-table-hover uk-table-striped uk-table-condensed">
              <thead>
                <tr>
                  <th>{$Think.lang.oid}</th>
				  <th>{$Think.lang.track_company}</th>
				  <th>{$Think.lang.track_url}</th>
				  <th>{$Think.lang.delivery_no}</th>
				  <th width=180>{$Think.lang.add_time}</th>
                </tr>
              </thead>
              <tbody>
				  <volist name="list" id="vo">
                <tr>
                  <td>{$vo.dv_oid}</td>
				  <td>{$vo.tk_company}</td>
				  <td>{$vo.tk_url}</td>
				  <td>{$vo.dv_number}</td>
				  <td>{$vo.dv_time}</td>
                </tr>
			</volist>
              </tbody>
            </table>
			{$page}
          </div>
		 
<!-- Modal -->
<div class="uk-modal" id="myModal">
 <form ng-controller="trackcontroller" ng-submit="upload('__CONTROLLER__/addHandle')" id="validate_form" class="uk-form"  method="post">
    <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a>
    <div class="uk-modal-header">{$Think.lang.add_delivery}</div>
<table class="uk-table">
	<tr><td width=120>{$Think.lang.oid}</td><td>
<input type="text" name="dv_oid"  ng-model="track.dv_oid"  required value="" />
</td></tr>
	<tr><td>{$Think.lang.track_company}</td><td>
<select name="dv_tk_id" required ng-model="track.dv_tk_id">
	<option value="">--</option>
	<volist name=":getTrackList()" id="vo">
	<option value="{$vo.tk_company}">{$vo.tk_company}</option>	
	</volist>	
</select>	
</td></tr>
	<tr><td>{$Think.lang.delivery_no}</td><td>
<input type="text" name="dv_number"   required  ng-model="track.dv_number" value="" />
</td></tr>

  </table>
        <div class="uk-modal-footer uk-text-right">
		<button class="uk-button uk-button-danger" type="submit">{$Think.lang.confirm}</button>
		</div>
    </div>
  </form> 
</div>

<div class="uk-modal" id="myModal1">	

 <form	 class="uk-form" enctype="multipart/form-data"  method="post" action="__CONTROLLER__/bulkDelivery">
    <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a>
    <div class="uk-modal-header">{$Think.lang.bulk_add_delivery}</div>
<table class="uk-table">
	<tr><td width=120>{$Think.lang.csv_file}</td><td>
<input type="file" name="csv"   required  />
</td></tr>
  </table>
  <div class="uk-alert uk-alert-warning">
{$Think.lang.bulk_upload_tip}
</div>
        <div class="uk-modal-footer uk-text-right">
		<button class="uk-button uk-button-danger" type="submit">{$Think.lang.confirm}</button>
		</div>
    </div>
  </form> 
</div>			  


<!-- Modal -->
<div class="uk-modal" id="myModal2">
    <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a>
    <div class="uk-modal-header">{$Think.lang.track_list}</div>
<table class="uk-table">
<volist name=":getObjectList('tracking')" id="vo">
	<tr><td><a target=_blank href="{$vo.tk_url}">{$vo.tk_company}</a></td><td>
	{$vo.tk_url}
</td></tr>
</volist>
  </table>

    </div>

</div>

